Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
@hazae41/bytes
Advanced tools
Utilities to deal with sized Uint8Array
npm i @hazae41/bytes
const bytes8 = Bytes.alloc(8) // Bytes<8>
const bytes8 = Bytes.allocUnsafe(8) // Bytes<8>
const bytes8 = Bytes.random(8) // Bytes<8>
const bytesX = new Uint8Array(8) // Bytes<number>
if (Bytes.is(bytesX, 8))
bytesX // Bytes<8>
else
bytesX // Bytes<number>
if (Bytes.equals(bytesX, bytes8))
bytesX // Bytes<8>
else
bytesX // Bytes<number>
const bytes16 = Bytes.tryCast(bytesX, 16).unwrap() // Bytes<16>
const sized4 = Sized.cast([1, 2, 3, 4], 4).unwrap() // Sized<4>
const bytes4 = Bytes.from(sized4) // Bytes<4>
Bytes.fromUtf8(Bytes.toUtf8(bytesX))
Bytes.fromHex(Bytes.toHex(bytesX))
Bytes.fromBase64(Bytes.toBase64(bytesX))
Bytes.fromAscii(Bytes.toAscii(bytesX))
Bytes.fromBigInt(Bytes.toBigInt(bytesX))
const bytes8 = Bytes.sliceOrPadStart(bytesX, 8) // Bytes<8>
FAQs
Utilities to deal with Uint8Array
We found that @hazae41/bytes demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.